package com.insurance.modules.claim.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.insurance.modules.claim.entity.SettlementAmountEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.insurance.common.utils.PageUtils;
import com.insurance.common.utils.Query;

import com.insurance.modules.claim.dao.SettlementPayDao;
import com.insurance.modules.claim.entity.SettlementPayEntity;
import com.insurance.modules.claim.service.SettlementPayService;


@Service("settlementPayService")
public class SettlementPayServiceImpl extends ServiceImpl<SettlementPayDao, SettlementPayEntity> implements SettlementPayService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SettlementPayEntity> page = this.page(
                new Query<SettlementPayEntity>().getPage(params),
                new QueryWrapper<SettlementPayEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public SettlementPayEntity getByCsId(String csId) {
        LambdaQueryWrapper<SettlementPayEntity> settlementQueryWrapper = Wrappers.lambdaQuery();
        settlementQueryWrapper.eq(SettlementPayEntity::getCsId, csId);
        SettlementPayEntity settlementPay = this.getOne(settlementQueryWrapper);
        return settlementPay == null ? new SettlementPayEntity() : settlementPay;
    }

}